package com.jintoufs.web.action.region;

import com.jintoufs.service.region.RegionService;
import com.jintoufs.util.ztree.TreeNode;
import com.jintoufs.web.action.support.SupportAction;
import org.apache.log4j.Logger;
import org.cosmos.modules.web.msg.AjaxMsg;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class RegionAction extends SupportAction {

    private static Logger log = Logger.getLogger(SupportAction.class);

    @Resource
    private RegionService regionService;

    @GetMapping("/region")
    public AjaxMsg getRegions() {
        List<TreeNode> regions = regionService.getModuleTree(null);
        return new AjaxMsg(AjaxMsg.SUCCESS, "获取成功", regions);
    }
}
